<?php
namespace app\index\controller;
use think\Controller;
use app\index\controller\Base;
use think\Db;
use app\index\model\blog;
class Category extends Base
{
    public function index()
    {
    	$base = new Base();
    	$base->bloginfo();
    	$id = input('id');
    	if (!is_numeric($id)) {
    		$this->error();
    	}
        $article = blog::
        where('type', '=', 'artice')
        ->where('show', '=', '1')
        ->where('cid',$id)
        ->order('time','desc')
        ->paginate(5);
        // 获取分页显示
        $page = $article->render();
        $this->assign('page', $page);
        //查询分类
        $categorys = db('category')->where('id',$id)->find();
        $this->assign('article',$article);
        $this->assign('categorys',$categorys);
    	return $this->fetch('./index/category');
    }
}
